DROP TABLE IF EXISTS jms_dwd.dwd_barscan_deliver_dt ;
CREATE EXTERNAL TABLE jms_dwd.dwd_barscan_deliver_dt (
billcode            string        comment  '运单编号' ,                     --nvarchar2(20)
scansitecode_later            string        comment  '扫描网点编号' ,                     --nvarchar2(20)
scantime_later            timestamp        comment  '扫描时间' ,                     --date
inputtime_later            timestamp        comment  '录入时间' ,                     --date
expresstype_later            string        comment  '快件类型' ,                     --nvarchar2(16)
nextstationcode_later            string        comment  '上下一站编号' ,                     --nvarchar2(20)
packagecode_later            string        comment  '所属袋号' ,                     --nvarchar2(20)
returnflag_later            tinyint        comment  '退件标识' ,                     --number(2)
scanuser_later            string        comment  '扫描雇员' ,                     --nvarchar2(30)
scanusercode_later            string        comment  '扫描雇员编号' ,                     --NVARCHAR2(20)
send_deliver_user_later            string        comment  '收派员' ,                     --nvarchar2(60)
send_deliver_usercode_later            string        comment  '收派员编号' ,                     --nvarchar2(30)
uploadtime_later            timestamp        comment  '上传时间' ,                     --date
weight_later            decimal(10, 2)        comment  '重量' ,                     --number(10,2)


scansitecode_early            string        comment  '扫描网点编号' ,                     --nvarchar2(20)
scantime_early            timestamp        comment  '扫描时间' ,                     --date
inputtime_early            timestamp        comment  '录入时间' ,                     --date
expresstype_early            string        comment  '快件类型' ,                     --nvarchar2(16)
nextstationcode_early            string        comment  '上下一站编号' ,                     --nvarchar2(20)
packagecode_early            string        comment  '所属袋号' ,                     --nvarchar2(20)
returnflag_early            tinyint        comment  '退件标识' ,                     --number(2)
scanuser_early            string        comment  '扫描雇员' ,                     --nvarchar2(30)
scanusercode_early            string        comment  '扫描雇员编号' ,                     --NVARCHAR2(20)
send_deliver_user_early            string        comment  '收派员' ,                     --nvarchar2(60)
send_deliver_usercode_early            string        comment  '收派员编号' ,                     --nvarchar2(30)
uploadtime_early            timestamp        comment  '上传时间' ,                     --date
weight_early            decimal(10, 2)        comment  '重量'                      --number(10,2)
)
    COMMENT '派件去重表'
    PARTITIONED BY (
         dimtype  STRING COMMENT '去重维度:billcode为运单维度去重;bill_scansite为运单加网点维度去重;',
         dt         STRING COMMENT '更新日期 (yyyy-MM-dd)')
    STORED AS PARQUET
    LOCATION '/dw/hive/jms_dwd.db/external/dwd_barscan_deliver_dt'
    TBLPROPERTIES (
        'discover.partitions' = 'false',
        'parquet.column.index.access' = 'true'
        );

MSCK REPAIR TABLE jms_dwd.dwd_barscan_deliver_dt;
